<script lang="ts">
import { defineComponent, h } from 'vue'
import { ElIcon } from 'element-plus'
import { SvgIcon } from '@/components/Icon'

export default defineComponent({
  name: 'Icon',
  props: {
    name: {
      type: String,
      required: true
    },
    size: {
      type: [String, Number],
      default: 16
    },
    color: {
      type: String,
      default: 'inherit'
    }
  },
  setup(props) {
    return () =>
      h(
        ElIcon,
        {
          size: props.size || '16px',
          color: props.color
        },
        () => h(SvgIcon, { ...props })
      )
  }
})
</script>
